home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Serial.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  3.9 KB  |  162 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Serial.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Serial;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __SERIAL__}
  27. {$SETC __SERIAL__ := 1}
  28.  
  29. {$I+}
  30. {$SETC SerialIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43. CONST
  44.     baud300                        = 380;
  45.     baud600                        = 189;
  46.     baud1200                    = 94;
  47.     baud1800                    = 62;
  48.     baud2400                    = 46;
  49.     baud3600                    = 30;
  50.     baud4800                    = 22;
  51.     baud7200                    = 14;
  52.     baud9600                    = 10;
  53.     baud19200                    = 4;
  54.     baud38400                    = 1;
  55.     baud57600                    = 0;
  56.     stop10                        = 16384;
  57.     stop15                        = -32768;
  58.     stop20                        = -16384;
  59.     noParity                    = 0;
  60.     oddParity                    = 4096;
  61.     evenParity                    = 12288;
  62.     data5                        = 0;
  63.     data6                        = 2048;
  64.     data7                        = 1024;
  65.     data8                        = 3072;
  66.  
  67.     ctsEvent                    = 32;
  68.     breakEvent                    = 128;
  69.     xOffWasSent                    = 128;
  70.     dtrNegated                    = 64;
  71.     ainRefNum                    = -6;                            {serial port A input}
  72.     aoutRefNum                    = -7;                            {serial port A output}
  73.     binRefNum                    = -8;                            {serial port B input}
  74.     boutRefNum                    = -9;                            {serial port B output}
  75.     swOverrunErr                = 1;                            {serial driver error masks}
  76.     breakErr                    = 8;                            {serial driver error masks}
  77.     parityErr                    = 16;                            {serial driver error masks}
  78.     hwOverrunErr                = 32;                            {serial driver error masks}
  79.     framingErr                    = 64;                            {serial driver error masks}
  80.     serdOptionClockExternal        = $40;                            {option bit used with Control code 16}
  81.     serdOptionPreserveDTR        = $80;                            {option bit used with Control code 16}
  82.  
  83.     sPortA                        = 0;
  84.     sPortB                        = 1;
  85.  
  86.     
  87. TYPE
  88.     SPortSel = SInt8;
  89.  
  90. { csCodes for serial driver Control routines }
  91.  
  92. CONST
  93.     serdReset                    = 8;
  94.     serdSetBuf                    = 9;
  95.     serdHShake                    = 10;
  96.     serdClrBrk                    = 11;
  97.     serdSetBrk                    = 12;
  98.     serdSetBaud                    = 13;
  99.     serdHShakeDTR                = 14;
  100.     serdSetMIDI                    = 15;
  101.     serdSetMisc                    = 16;
  102.     serdSetDTR                    = 17;
  103.     serdClrDTR                    = 18;
  104.     serdSetPEChar                = 19;
  105.     serdSetPECharAlternate        = 20;
  106.     serdSetXOff                    = 21;
  107.     serdClrXOff                    = 22;
  108.     serdSendXOnConditional        = 23;
  109.     serdSendXOn                    = 24;
  110.     serdSendXOffConditional        = 25;
  111.     serdSendXOff                = 26;
  112.     serdChannelReset            = 27;
  113.     serdSet230KBaud                = 'JF';                            { set 230K baud data rate }
  114.     serdSetPollWrite            = 'jf';                            { disable interrupt-driven transmit }
  115.     serdSetFlushCount            = 'FC';
  116.  
  117. { csCodes for serial driver Status routines }
  118.     serdGetBuf                    = 2;
  119.     serdStatus                    = 8;
  120.     serdGetVers                    = 9;
  121.     serdGetVersSys                = $8000;
  122.  
  123.  
  124. TYPE
  125.     SerShk = PACKED RECORD
  126.         fXOn:                    Byte;                                    {XOn flow control enabled flag}
  127.         fCTS:                    Byte;                                    {CTS flow control enabled flag}
  128.         xOn:                    CHAR;                                    {XOn character}
  129.         xOff:                    CHAR;                                    {XOff character}
  130.         errs:                    Byte;                                    {errors mask bits}
  131.         evts:                    Byte;                                    {event enable mask bits}
  132.         fInX:                    Byte;                                    {Input flow control enabled flag}
  133.         fDTR:                    Byte;                                    {DTR input flow control flag}
  134.     END;
  135.     SerStaRec = PACKED RECORD
  136.         cumErrs:                Byte;
  137.         xOffSent:                Byte;
  138.         rdPend:                    Byte;
  139.         wrPend:                    Byte;
  140.         ctsHold:                Byte;
  141.         xOffHold:                Byte;
  142.     END;
  143.  
  144. FUNCTION SerReset(refNum: INTEGER; serConfig: INTEGER): OSErr;
  145. FUNCTION SerSetBuf(refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER): OSErr;
  146. FUNCTION SerHShake(refNum: INTEGER; {CONST}VAR flags: SerShk): OSErr;
  147. FUNCTION SerSetBrk(refNum: INTEGER): OSErr;
  148. FUNCTION SerClrBrk(refNum: INTEGER): OSErr;
  149. FUNCTION SerGetBuf(refNum: INTEGER; VAR count: LONGINT): OSErr;
  150. FUNCTION SerStatus(refNum: INTEGER; VAR serSta: SerStaRec): OSErr;
  151.  
  152. {$ALIGN RESET}
  153. {$POP}
  154.  
  155. {$SETC UsingIncludes := SerialIncludes}
  156.  
  157. {$ENDC} {__SERIAL__}
  158.  
  159. {$IFC NOT UsingIncludes}
  160.  END.
  161. {$ENDC}
  162.